#ifndef APP_I2C_BUS_H
#define APP_I2C_BUS_H
#include "at32f415_gpio_driver.h"

typedef struct I2C_BUS{
    AT32F415GPIO *sda_out;
    AT32F415GPIO *sda_in;
    AT32F415GPIO *scl;
    uint8_t (*start)(struct I2C_BUS *thiss);
    void (*stop)(struct I2C_BUS *thiss);
    void (*txByte)(struct I2C_BUS *thiss,unsigned char data);
    unsigned char (*rxByte)(struct I2C_BUS *thiss);
    void (*ack)(struct I2C_BUS *thiss);
    void (*noack)(struct I2C_BUS *thiss);
    uint8_t (*waitack)(struct I2C_BUS *thiss);
}I2C_BUS;

void i2c_bus_init(struct I2C_BUS *thiss,struct AT32F415GPIO *sda_out,struct AT32F415GPIO *sda_in,struct AT32F415GPIO *scl);
#endif